package com.coolingme.mouseevent;

import com.coolingme.mouseevent.handler.Mouse;
import com.coolingme.mouseevent.handler.MouseEventListener;
import com.coolingme.mouseevent.handler.MouseEventType;

/**
 * 测试类
 *
 * @author wangyue
 * @date 2020-10-19 23:22
 */
public class Test {
    public static void main(String[] args) {
        // 观察者
        MouseEventListener listener = new MouseEventListener();

        // 被观察者
        Mouse mouse = new Mouse();
        // 注册
        mouse.addListener(MouseEventType.ON_CLICK, listener);
        mouse.addListener(MouseEventType.ON_MOVE, listener);

        mouse.click();
        // 双击未注册，不会被监听
        mouse.doubleClick();
        mouse.move();
    }
}
